package com.play.airfight.managers;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;

import com.play.airfight.R;
import com.play.applicaiton.MyApplication;
import com.play.airfight.GlobalInfo;
import com.play.airfight.utils.UiUtils;

public class Player {

    private static Player instance;

    public static Player getInstance() {
        if (instance == null) {
            instance = new Player();
        }
        return instance;
    }

    public static int width = 50;
    public static int height = 50;

    public static int currentX = GlobalInfo.screenW / 2; // 默认出生屏幕水平中间
    public static int currentY = GlobalInfo.screenH - 100; // 默认出生屏幕最下方往上100px处
    public int shape = R.drawable.plane;

    public void drawFrame(Canvas canvas) {

        Paint p = new Paint();
        Bitmap bitmap = BitmapFactory.decodeResource(MyApplication.getContext().getResources(), shape);
        bitmap = Bitmap.createScaledBitmap(bitmap, UiUtils.dip2Pixel(width), UiUtils.dip2Pixel(height), true);
        canvas.drawBitmap(bitmap, currentX - bitmap.getWidth() / 2, currentY - bitmap.getHeight() / 2, p);


    }


    public void execLogic() {
        // 敌人子弹和我碰撞
    }

}
